package com.biz.primus.model.member.enums;

import com.biz.primus.common.enums.EnumerableValue;
import com.biz.primus.common.enums.converter.BaseEnumValueConverter;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

/**
 * 类说明：性别枚举
 *
 * @author jun.liu
 */
@ApiModel("性别")
public enum SexTypes implements EnumerableValue
{

    @ApiModelProperty("女性")
    female(0, "女性"),
    @ApiModelProperty("男性")
    male(1, "男性"),
    @ApiModelProperty("保密")
    secret(2, "保密");

    public static class Converter extends BaseEnumValueConverter<SexTypes>
    {
    }

    private int value;
    private String desc;

    SexTypes(int value, String desc)
    {
        this.value = value;
        this.desc = desc;
    }

    @Override
    public int getValue() {
        return value;
    }

    public String getDesc() {
        return desc;
    }

    public static SexTypes getSexByValue(int codeVal)
    {
        for (SexTypes sex : SexTypes.values())
        {
            if (sex.getValue() == codeVal)
            {
                return sex;
            }
        }
        return null;
    }
}
